﻿//Write an expression that checks for given point (x, y) if it is within the circle K( (1,1), 3) 
//and out of the rectangle R(top=1, left=-1, width=6, height=2).

using System;

class IfPointWithinCircleOutRectangle
{
    static void Main()
    {
        Console.WriteLine("Input point coordinates");
        Console.Write("x = ");
        double pointX = double.Parse(Console.ReadLine().Replace(".", ","));
        Console.Write("y = ");
        double pointY = double.Parse(Console.ReadLine().Replace(".", ","));

        //Cirle parameters
        double circleCenterX = 1;
        double circleCenterY = 1;
        double circleRadius = 3;

        //Rectangle parameters
        double rectangleTopLeftX = -1;
        double rectangleTopLeftY = 1;
        double rectangleWidth = 6;
        double rectangleHeight = 2;
        double rectangleBottomRightX = rectangleTopLeftX + rectangleWidth;
        double rectangleBottomRightY = rectangleTopLeftY - rectangleHeight;

        bool isWithinCircle = ((pointX - circleCenterX) * (pointX - circleCenterX)) + ((pointY - circleCenterY) * (pointY * circleCenterY)) <= (circleRadius * circleRadius);
        bool isOutOfRectangle = ((pointX < rectangleTopLeftX) || (pointX > rectangleBottomRightX)) ||
                                ((pointY < rectangleBottomRightY) || (pointY > rectangleTopLeftY));

        if (isWithinCircle && isOutOfRectangle)
            Console.WriteLine("Point ({0},{1}) is within a circle K(({2},{3}),{4}) and out of rectangle (Top = {5}, Left = {6}, Width = {7}, Height = {8}).",
                               pointX, pointY, circleCenterX, circleCenterY, circleRadius, rectangleTopLeftY, rectangleTopLeftX, rectangleWidth, rectangleHeight);
        else
            Console.WriteLine("Point ({0},{1}) is NOT within a circle K(({2},{3}),{4}) or WITHIN rectangle (Top = {5}, Left = {6}, Width = {7}, Height = {8}).",
                               pointX, pointY, circleCenterX, circleCenterY, circleRadius, rectangleTopLeftY, rectangleTopLeftX, rectangleWidth, rectangleHeight);
    }
}
